<?php

namespace app\admin\controller;

use think\Controller;

class Upload extends Base
{
    public function upload()
    {
        $file=request()->file('file');
        $info=$file->move('./uploads'); 

        if ($info) {
            $path='/uploads/' . $info->getSaveName();
            return ['code'=>200,'msg'=>'上传成功','url'=>$path];       
        }else{  
            return ['code'=>400,'msg'=>$file->getError()];
        }
    }
}
